<?php
include "connect.php";
$name		= $_REQUEST['name'];
$password	= $_REQUEST['password'];
$ins = "select count(*) from user where name = '$name'";
$result = mysql_query($ins,$connect);
$row = mysql_fetch_row($result);
$count = $row[0];
if ($count > 0)
{
echo "<script>alert('用户已被注册！');</script>";
echo "<script>window.location='index.php';</script>";
} 
else 
{ 
$ins="insert into user (name,password) values ('{$name}','{$passward}')";
$result=mysql_query($ins,$connect);
if ($result)
{ 
echo "<script>alert('用户注册成功！');</script>";
echo "<script>window.location='login.php';</script>";
}
}
?>
